import { Module } from '@nestjs/common'
import { DepartmentService } from './department.service'
import { DepartmentController } from './department.controller'
import { Department } from './department.mysql.entity'

@Module({
  controllers: [DepartmentController],
  providers: [
    DepartmentService,
    {
      provide: 'DEP_REPOSITORY',
      useFactory: async (AppDataSource) =>
        await AppDataSource.getRepository(Department),
      inject: ['MYSQL_DATA_SOURCE'],
    },
  ],
  exports: [DepartmentService],
})
export class DepartmentModule {}
